package com.dong.environment.propertysource;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.core.env.Environment;

/**
 * description
 *
 * @author Administrator 2021/09/06 18:15
 */
@Configuration
@PropertySource("classpath:/app.properties")
public class AppConfig {

    @Autowired
    Environment environment;

    @Bean
    public MyBean myBean(){
        MyBean myBean = new MyBean();
        myBean.setName(environment.getProperty("myBean.name"));
        return myBean;
    }
}
